package com.jutu;

import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;

public class Test {

    private static ThreadLocal<Integer> threadLocal = new ThreadLocal<>();


    public static void main(String[] args) throws InterruptedException {

        threadLocal.set(10);

        System.out.println("主线程"+threadLocal.get());

        new Thread(){
            @Override
            public void run() {
                threadLocal.set(20);
                System.out.println("重启的线程"+threadLocal.get());
            }
        }.start();

        Thread.sleep(1000);
        System.out.println("这是主线程还是重启的那个线程"+ threadLocal.get());

    }

}
